tests/installed: Move tasks into tasks/ directory
authorColin Walters <walters@verbum.org>
Wed, 11 Apr 2018 17:33:31 +0000 (13:33 -0400)
committerAtomic Bot <atomic-devel@projectatomic.io>
Wed, 11 Apr 2018 19:11:07 +0000 (19:11 +0000)
It's cleaner to separate test playbooks from their tasks.

Closes: #1535
Approved by: jlebon

tests/installed/destructive.yml
tests/installed/nondestructive.yml
tests/installed/overlay-git.yml [deleted file]
tests/installed/tasks/overlay-git.yml [new file with mode: 0644]
tests/installed/tasks/query-host.yml [new file with mode: 0644]

index 26843e7d1bf4bb229f904464b14aa33ab78d049f..9529c7e980d4183a0e29f87409e2f5269f209b29 100644 (file)
@@ -8,7 +8,10 @@
     use_git_build: True
     tests: "."
   tasks:
-    - import_tasks: overlay-git.yml
+    - import_tasks: tasks/query-host.yml
+    - set_fact:
+        rpmostree_initial_deployment: "{{ rpmostree_status[\"deployments\"][0] }}"
+    - import_tasks: tasks/overlay-git.yml
       when: use_git_build
     # Next copy all of the tests/ directory
     - name: Copy test data
index 88a6487461a2af3aad640a07a428c7318df5f2ae..dcd0d442de359c39667300fe16d77b0215fdcbb2 100644 (file)
@@ -10,7 +10,8 @@
     # Arbitrary...we want some parallelism
     batching_factor: 4
   tasks:
-    - import_tasks: overlay-git.yml
+    - import_tasks: tasks/query-host.yml
+    - import_tasks: tasks/overlay-git.yml
       when: use_git_build
     # Next copy all of the tests/ directory
     - name: Copy test data
diff --git a/tests/installed/overlay-git.yml b/tests/installed/overlay-git.yml
deleted file mode 100644 (file)
index 0018a1b..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-# Run "admin unlock" and add locally built RPMs, then
-# copy the whole tests/ directory into the VM.
-- command: ostree --version
-  changed_when: False
-  register: ostree_orig_version
-- set_fact:
-    ostree_orig_version_yaml: "{{ ostree_orig_version.stdout | from_yaml }}"
-- name: Copy locally built RPMs
-  synchronize: src=build/x86_64/ dest=/root/x86_64/ archive=yes
-- shell: ostree admin unlock || true
-# Install the RPMs we already have.  For the test suite we use rpm2cpio
-# since it depends on libsoup, but we're not using that yet for the sysinstalled tests
-- shell: >
-    /usr/bin/rpm -Fvh /root/x86_64/*.rpm && \
-    cd / && rpm2cpio /root/x86_64/ostree-tests-2*.rpm | cpio -div
-- command: ostree --version
-  register: ostree_new_version
-- set_fact:
-    ostree_new_version_yaml: "{{ ostree_new_version.stdout | from_yaml }}"
-- name: "Fail if we didn't change the ostree version"
-  when: ostree_orig_version_yaml['libostree']['Git'] == ostree_new_version_yaml['libostree']['Git']
-  fail:
-    msg: "Failed to change ostree version"
diff --git a/tests/installed/tasks/overlay-git.yml b/tests/installed/tasks/overlay-git.yml
new file mode 100644 (file)
index 0000000..0018a1b
--- /dev/null
@@ -0,0 +1,23 @@
+# Run "admin unlock" and add locally built RPMs, then
+# copy the whole tests/ directory into the VM.
+- command: ostree --version
+  changed_when: False
+  register: ostree_orig_version
+- set_fact:
+    ostree_orig_version_yaml: "{{ ostree_orig_version.stdout | from_yaml }}"
+- name: Copy locally built RPMs
+  synchronize: src=build/x86_64/ dest=/root/x86_64/ archive=yes
+- shell: ostree admin unlock || true
+# Install the RPMs we already have.  For the test suite we use rpm2cpio
+# since it depends on libsoup, but we're not using that yet for the sysinstalled tests
+- shell: >
+    /usr/bin/rpm -Fvh /root/x86_64/*.rpm && \
+    cd / && rpm2cpio /root/x86_64/ostree-tests-2*.rpm | cpio -div
+- command: ostree --version
+  register: ostree_new_version
+- set_fact:
+    ostree_new_version_yaml: "{{ ostree_new_version.stdout | from_yaml }}"
+- name: "Fail if we didn't change the ostree version"
+  when: ostree_orig_version_yaml['libostree']['Git'] == ostree_new_version_yaml['libostree']['Git']
+  fail:
+    msg: "Failed to change ostree version"
diff --git a/tests/installed/tasks/query-host.yml b/tests/installed/tasks/query-host.yml
new file mode 100644 (file)
index 0000000..2a67dbd
--- /dev/null
@@ -0,0 +1,5 @@
+- command: rpm-ostree status --json
+  changed_when: False
+  register: rpmostree_status_json
+- set_fact:
+    rpmostree_status: "{{ rpmostree_status_json.stdout | from_json }}"